<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title>用户查询</title>
  <link rel="stylesheet" href="css/User.css">
</head>
<body>
<h2>用户查询</h2>
<form method="get" action="UserServlet">
  <label for="userId">按用户ID查询:</label>
  <input type="text" id="userId" name="userId" />
  <input type="submit" value="查询" />
</form>

<h3>用户列表</h3>
<table border="1">
  <tr>
    <th>ID</th>
    <th>昵称</th>
    <th>账号</th>
    <th>邮箱</th>
    <th>手机号</th>
    <th>状态</th>
  </tr>
  <c:choose>
    <c:when test="${not empty user}">
      <tr>
        <td>${user.id}</td>
        <td>${user.nickname}</td>
        <td>${user.username}</td>
        <td>${user.email}</td>
        <td>${user.phone}</td>
        <td>${user.status}</td>
      </tr>
    </c:when>
    <c:otherwise>
      <c:forEach var="user" items="${users}">
        <tr>
          <td>${user.id}</td>
          <td>${user.nickname}</td>
          <td>${user.username}</td>
          <td>${user.email}</td>
          <td>${user.phone}</td>
          <td>${user.status}</td>
        </tr>
      </c:forEach>
    </c:otherwise>
  </c:choose>
</table>
</body>
</html>
